package com.example.service.impl;


import com.example.dao.ResumeDao;
import com.example.pojo.Resume;
import com.example.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;


@Service
@Transactional
public class ResumeServiceImpl implements ResumeService {

    @Autowired
    private ResumeDao resumeDao;

    @Override
    public List<Resume> queryResumeList() throws Exception {
        return resumeDao.findAll();
    }

    @Override
    public void addResume(Resume resume) throws Exception {
        resumeDao.save(resume);
    }

    @Override
    public Resume queryById(Long id) throws Exception {
        Optional<Resume> byId = resumeDao.findById(id);
        return byId.get();
    }

    @Override
    public void delete(Long id) throws Exception {
        resumeDao.deleteById(id);
    }

}
